version: '3.1'

services:
  db:
    image: postgres:13.7
    privileged: true
    restart: always
    ports:
      - 54328:5432
    environment:
      POSTGRES_DB: 'backend'
      POSTGRES_USER: 'sergey'
      POSTGRES_PASSWORD: '12345'

  backend:
    build: ./backend
    privileged: true
    restart: always
    ports:
      - 8080:8080
    depends_on:
      - db
    command: bash -c "
        python manage.py migrate && 
        gunicorn backend.wsgi -b 0.0.0.0:8088
      "
    environment:
      DJANGO_SETTINGS_MODULE: backend.settings.production

  nginx:
    build: ./nginx
    privileged: true
    restart: always
    ports:
      - 8000:80
    depends_on:
      - backend

  frontend:
    build: ./frontend
    privileged: true
    restart: always
    ports:
      - 80:80
    depends_on:
      - nginx


